import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {HttpModule} from '@angular/http';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {LoginComponent} from './login/login.component';
import {PageNotFoundComponent} from './common/page-not-found.component';
import {DispatcherComponent} from './dispatcher/dispatcher.component';
import {AuthGuardService} from './services/auth-guard.service';
import {AuthService} from './services/auth.service';
import {DispatcherResolveService} from './dispatcher/dispatcher-resolve.service';
import {DataStorageUtil} from './util/data-storage-util';
import {RequestUtil} from './util/request-util';
import {LogUtil} from './util/log-util';
import {ResponseUtil} from './util/response-util';
import {PageSubject} from './util/page-subject';
import {TableUtil} from './util/table-util';
import {FormUtil} from './util/form-util';
import {TreeUtil} from './util/tree-util';
import {OnlineService} from './services/online.service';
import {TokenUtil} from './util/token-util';
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
import {TokenInterceptor} from './util/custom-interceptor';
import {CustomHttpClient} from './tools/http/custom-http-client';
import {CustomHttp} from './tools/http/custom-http';
import {OneDialogModule} from './widgets/one-dialog/one-dialog.module';
import {ClientAuthComponent} from './auth/client-auth.component';
import {ErrorComponent} from './common/error.component';
import {ClientAuthResolveService} from './auth/client-auth-resolve.service';
import {MapUtil} from './util/map-util';
import {DynamicUtil} from './tools/dynamicUtil/dynamic-util';
import {AlarmSubject} from './util/alarm-subject';
import {MenuSubject} from './subject/menu-subject';
import {SortablejsModule} from 'angular-sortablejs';
import {MenusService} from './services/menus.service';
import {EncodeUtil} from './util/encode-util';
import {SiteStatusSubject} from './util/site-status-subject';
import {NgZorroAntdModule} from 'ng-zorro-antd';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

let modules = [
  BrowserModule,
  FormsModule,
  HttpModule,
  AppRoutingModule,
  OneDialogModule,
  HttpClientModule,
  SortablejsModule.forRoot({
    animation: 200,
  }),
  NgZorroAntdModule.forRoot(),
  BrowserAnimationsModule
];

let components = [
  AppComponent,
  LoginComponent,
  PageNotFoundComponent,
  DispatcherComponent,
  ClientAuthComponent,
  ErrorComponent
];

let services = [
  {
    provide:HTTP_INTERCEPTORS,
    useClass:TokenInterceptor,
    multi:true
  },
  AuthGuardService,
  AuthService,
  DispatcherResolveService,
  DataStorageUtil,
  RequestUtil,
  ResponseUtil,
  LogUtil,
  PageSubject,
  TableUtil,
  FormUtil,
  TreeUtil,
  EncodeUtil,
  OnlineService,
  TokenUtil,
  CustomHttpClient,
  CustomHttp,
  MenusService,
  ClientAuthResolveService,
  MapUtil,
  DynamicUtil,
  AlarmSubject,
  MenuSubject,
  SiteStatusSubject
];


@NgModule({
  declarations: [
    ...components
  ],
  imports: [
    ...modules
  ],
  providers: [
    ...services
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
